package sui.template
{

    public class IndexExp implements IExpression
    {
        private var index:int = 0;

        public function IndexExp(index:Number)
        {
            this.index = index;
        }

        public function exec(context:Object):*
        {
            if (!(context is Array))
            {
                throw new ArgumentError("to use index expression, the context parameter must be an array");
            }
            return (context as Array)[index];
        }
    }
}
